// 关于新闻请求
import request from '@/utils/request.js'

/**
 * 获取新闻列表
 * @param {Object} params {}
 * @returns
 */
export const getArticlesList = params => {
  return request({
    method: 'GET',
    url: '/v1_1/articles',
    // post这样传参
    // data: data
    params
  })
}

/**
* 获取频道的文章列表
*/
export const getArticleById = articleId => {
  return request({
    method: 'GET',
    url: '/v1_0/articles/' + articleId
  })
}

/**
 * 添加文章收藏
 * @param {*} target 文章id
 * @returns
 */
export const addCollected = target => {
  return request({
    method: 'POST',
    url: '/v1_0/article/collections',
    data: {
      target
    }
  })
}

/**
 * 删除文章收藏
 * @param {*} target 文章id
 * @returns
 */
export const delCollected = target => {
  return request({
    method: 'DELETE',
    url: 'v1_0/article/collections/' + target
  })
}
